﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MONTRASEC_test.Classes;

namespace MONTRASEC_test.Controls
{
  public partial class wucDVC1Events : System.Web.UI.UserControl
  {
    //copy this part
    public Label LbTotalRecords
    {
      get { return lbTotalRecords; }
      set { lbTotalRecords = value; }
    }

    public Label LDVMode
    {
      get { return lbDVMode; }
      set { lbDVMode = value; }
    }
    public BulletedList BPleaseFillOtherTemplates
    {
      get { return bPleaseFillOtherTemplates; }
      set { bPleaseFillOtherTemplates = value; }
    }
    public DetailsView dv
    {
      //change the DetailsView field name
      get { return dvC1Events; }
      set { dvC1Events = value; }
    }


    //until here

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void dvC1Events_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
      e.Values["C_1_EVENT_ECPDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["C_1_EVENT_ECPDATE_PERIODOFTHEEVENT"]);

      e.Values["C_1_EVENT_ESASEXUALASSAULTDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["C_1_EVENT_ESASEXUALASSAULTDATE_PERIODOFTHEEVENT"]);

      e.Values["C_1_EVENT_ESTSEXTOURINSMDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["C_1_EVENT_ESTSEXTOURINSMDATE_PERIODOFTHEEVENT"]);

      e.Values["C_1_EVENT_ECPRODATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.Values["C_1_EVENT_ECPRODATE_PERIODOFTHEEVENT"]);
    }

    protected void dvC1Events_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
      e.NewValues["C_1_EVENT_ECPDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["C_1_EVENT_ECPDATE_PERIODOFTHEEVENT"]);

      e.NewValues["C_1_EVENT_ESASEXUALASSAULTDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["C_1_EVENT_ESASEXUALASSAULTDATE_PERIODOFTHEEVENT"]);

      e.NewValues["C_1_EVENT_ESTSEXTOURINSMDATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["C_1_EVENT_ESTSEXTOURINSMDATE_PERIODOFTHEEVENT"]);

      e.NewValues["C_1_EVENT_ECPRODATE_PERIODOFTHEEVENT"] = UtilHelper.getDateTime(e.NewValues["C_1_EVENT_ECPRODATE_PERIODOFTHEEVENT"]);
    }
    protected void detailsView_ModeChanged(object sender, EventArgs e)
    {
      onDetailsView_ModeChanged(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ModeChangedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ModeChangedHandler DetailsView_ModeChanged;

    protected virtual void onDetailsView_ModeChanged(EventArgs e)
    {
      if (DetailsView_ModeChanged != null)
      {
        DetailsView_ModeChanged(this, e);
      }
    }

    protected void detailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
    {
      onDetailsView_ItemDeleted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemDeletedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemDeletedHandler DetailsView_ItemDeleted;

    protected virtual void onDetailsView_ItemDeleted(EventArgs e)
    {
      if (DetailsView_ItemDeleted != null)
      {
        DetailsView_ItemDeleted(this, e);
      }
    }

    protected void detailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
      onDetailsView_ItemInserted(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemInsertedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemInsertedHandler DetailsView_ItemInserted;

    protected virtual void onDetailsView_ItemInserted(EventArgs e)
    {
      if (DetailsView_ItemInserted != null)
      {
        DetailsView_ItemInserted(this, e);
      }
    }

    protected void detailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {

      onDetailsView_ItemUpdated(e);
    }
    // the delegate; a delegate is a reference type used to encapsulate a method with a specific signature and return type.* You can encapsulate any matching method in that delegate.
    public delegate void detailsView_ItemUpdatedHandler(object sender, EventArgs e);

    // an instance of the delegate
    public event detailsView_ItemUpdatedHandler DetailsView_ItemUpdated;

    protected virtual void onDetailsView_ItemUpdated(EventArgs e)
    {
      if (DetailsView_ItemUpdated != null)
      {
        DetailsView_ItemUpdated(this, e);
      }
    }

    protected void replicateARow(object sender, DetailsViewCommandEventArgs e)
    {
      String myMessage = ""; //message listing the id's that have been updated
      DetailsView dv = (DetailsView)sender;
      int index = int.Parse(e.CommandArgument.ToString());

      String id = (dv.DataKey["ID"]).ToString();

      MONTRASEC_test.Classes.A_NEWENTRY_DataContext dataContext = new MONTRASEC_test.Classes.A_NEWENTRY_DataContext();

      var newEntryToCopy =
          from b in dataContext.GetTable<A_NEWENTRY_>()
          where b.ID == long.Parse(id)
          select b;



      foreach (A_NEWENTRY_ c in newEntryToCopy)
      {
        var recordsToWhichToReplicate =
          from listOfRecordsToReplicate in dataContext.GetTable<A_NEWENTRY_>()
          where listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_POLICE_CUSTOMSFILEIDENTIF.Equals(c.A_NEWENTRY_NEWENTRY_POLICE_CUSTOMSFILEIDENTIF)
          && listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_PUBLICPROSECUTORSFILEIDEN.Equals(c.A_NEWENTRY_NEWENTRY_PUBLICPROSECUTORSFILEIDEN)
          && listOfRecordsToReplicate.A_NEWENTRY_NEWENTRY_COURTSFILEIDENTIFICATIONN.Equals(c.A_NEWENTRY_NEWENTRY_COURTSFILEIDENTIFICATIONN)
          && listOfRecordsToReplicate.ID != c.ID
          select listOfRecordsToReplicate;

        foreach (A_NEWENTRY_ recordToWhichToReplicate in recordsToWhichToReplicate)
        {

          recordToWhichToReplicate.C_1_Event_DIGEST = c.C_1_Event_DIGEST;
          recordToWhichToReplicate.C_1_Event_DIGEST_NFP = c.C_1_Event_DIGEST_NFP;
          recordToWhichToReplicate.C_1_EVENT_EVENTOFCHILDPORNOGRAPHY_EVENTOFCHILDPORNOGRAPHY = c.C_1_EVENT_EVENTOFCHILDPORNOGRAPHY_EVENTOFCHILDPORNOGRAPHY;
          recordToWhichToReplicate.C_1_EVENT_ECPACTIVITIES_PRODUCTIONOFCHILDPORNOGRA = c.C_1_EVENT_ECPACTIVITIES_PRODUCTIONOFCHILDPORNOGRA;
          recordToWhichToReplicate.C_1_EVENT_ECPACTIVITIES_DISTRIBUTION_DISSEMINATIO = c.C_1_EVENT_ECPACTIVITIES_DISTRIBUTION_DISSEMINATIO;
          recordToWhichToReplicate.C_1_EVENT_ECPACTIVITIES_VIATHEINTERNET_DISTRIBUTI = c.C_1_EVENT_ECPACTIVITIES_VIATHEINTERNET_DISTRIBUTI;
          recordToWhichToReplicate.C_1_EVENT_ECPACTIVITIES_SUPPLYINGORMAKINGAVAILABL = c.C_1_EVENT_ECPACTIVITIES_SUPPLYINGORMAKINGAVAILABL;
          recordToWhichToReplicate.C_1_EVENT_ECPACTIVITIES_VIATHEINTERNET_SUPPLYINGO = c.C_1_EVENT_ECPACTIVITIES_VIATHEINTERNET_SUPPLYINGO;
          recordToWhichToReplicate.C_1_EVENT_ECPACTIVITIES_ACQUISITIONOFCHILDPORNOGR = c.C_1_EVENT_ECPACTIVITIES_ACQUISITIONOFCHILDPORNOGR;
          recordToWhichToReplicate.C_1_EVENT_ECPACTIVITIES_POSSESSIONOFCHILDPORNOGRA = c.C_1_EVENT_ECPACTIVITIES_POSSESSIONOFCHILDPORNOGRA;
          recordToWhichToReplicate.C_1_EVENT_ECPDATE_PERIODOFTHEEVENT = c.C_1_EVENT_ECPDATE_PERIODOFTHEEVENT;
          recordToWhichToReplicate.C_1_EVENT_ECPDURATIONOFTHEEVENT_DURATION = c.C_1_EVENT_ECPDURATIONOFTHEEVENT_DURATION;
          recordToWhichToReplicate.C_1_EVENT_ECPCOUNTRYOFTHEEVENT_COUNTRY = c.C_1_EVENT_ECPCOUNTRYOFTHEEVENT_COUNTRY;
          recordToWhichToReplicate.C_1_EVENT_ECPMEANSUSEDTOMAKECHILDPO_THEINTERNET = c.C_1_EVENT_ECPMEANSUSEDTOMAKECHILDPO_THEINTERNET;
          recordToWhichToReplicate.C_1_EVENT_ECPMEANSUSEDTOMAKECHILDPO_MAIL_EXPRESSCOURIER = c.C_1_EVENT_ECPMEANSUSEDTOMAKECHILDPO_MAIL_EXPRESSCOURIER;
          recordToWhichToReplicate.C_1_EVENT_ECPMEANSUSEDTOMAKECHILDPO_PERSONALCONTACT = c.C_1_EVENT_ECPMEANSUSEDTOMAKECHILDPO_PERSONALCONTACT;
          recordToWhichToReplicate.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_SEIZUREOFPORNOGRAPHICMEDI = c.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_SEIZUREOFPORNOGRAPHICMEDI;
          recordToWhichToReplicate.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_IDENTIFIEDVICTIMS = c.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_IDENTIFIEDVICTIMS;
          recordToWhichToReplicate.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_NOTAREALCHILD = c.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_NOTAREALCHILD;
          recordToWhichToReplicate.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_IDENTIFIEDAUTHORWHOISSEXU = c.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_IDENTIFIEDAUTHORWHOISSEXU;
          recordToWhichToReplicate.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_CONVICTEDAUTHOR = c.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_CONVICTEDAUTHOR;
          recordToWhichToReplicate.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_SUSPECTAUTHOR = c.C_1_EVENT_ECPSEIZUREOFCHILDPORNOGRA_SUSPECTAUTHOR;
          recordToWhichToReplicate.C_1_EVENT_ECPNUMBEROFPICTURESSEIZED_NUMBEROFPICTURESSEIZED = c.C_1_EVENT_ECPNUMBEROFPICTURESSEIZED_NUMBEROFPICTURESSEIZED;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_HACKINGCOMPUTERPROTECTION = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_HACKINGCOMPUTERPROTECTION;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_SEXUALASSAULT = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_SEXUALASSAULT;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_RAPE = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_RAPE;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_CHILDPROSTITUTION = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_CHILDPROSTITUTION;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_UNDECLAREDEMPLOYMENT = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_UNDECLAREDEMPLOYMENT;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_COUNTERFEITING = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_COUNTERFEITING;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABDUCTION = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABDUCTION;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_KEEPINGABROTHEL = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_KEEPINGABROTHEL;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_TRAFFICKINGINHUMANBEINGS = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_TRAFFICKINGINHUMANBEINGS;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABUSEOFPOSITION = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ABUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ADMINISTRATIONOFDRUGS_MED = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_ADMINISTRATIONOFDRUGS_MED;
          recordToWhichToReplicate.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_DECEPTIONOFTHEVICTIMINORD = c.C_1_EVENT_ECPACTCTXCHILDPRONOGRAPHY_DECEPTIONOFTHEVICTIMINORD;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_VIATHEINTERNET = c.C_1_EVENT_ECPMODUSOPERANDI_VIATHEINTERNET;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_SEXUALINTERCOURSE = c.C_1_EVENT_ECPMODUSOPERANDI_SEXUALINTERCOURSE;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_SEXUALAGGRESSION = c.C_1_EVENT_ECPMODUSOPERANDI_SEXUALAGGRESSION;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_THROUGHEROTIC_PORNOGRAPHI = c.C_1_EVENT_ECPMODUSOPERANDI_THROUGHEROTIC_PORNOGRAPHI;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_MISUSEOFPOSITION = c.C_1_EVENT_ECPMODUSOPERANDI_MISUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_ADMINISTRATIONOFDRUGS = c.C_1_EVENT_ECPMODUSOPERANDI_ADMINISTRATIONOFDRUGS;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_ADMINISTRATIONOFMEDICINES = c.C_1_EVENT_ECPMODUSOPERANDI_ADMINISTRATIONOFMEDICINES;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_TAKESVICTIMAWAY = c.C_1_EVENT_ECPMODUSOPERANDI_TAKESVICTIMAWAY;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_LOCKSVICTIMAWAY_TIESHIM_H = c.C_1_EVENT_ECPMODUSOPERANDI_LOCKSVICTIMAWAY_TIESHIM_H;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_BYMEANSOFDECEPTION = c.C_1_EVENT_ECPMODUSOPERANDI_BYMEANSOFDECEPTION;
          recordToWhichToReplicate.C_1_EVENT_ECPMODUSOPERANDI_BYMEANSOFFORCE_THREAT = c.C_1_EVENT_ECPMODUSOPERANDI_BYMEANSOFFORCE_THREAT;
          recordToWhichToReplicate.C_1_EVENT_EVENTOFSEXUALASSAULT_EVENTOFSEXUALASSAULT = c.C_1_EVENT_EVENTOFSEXUALASSAULT_EVENTOFSEXUALASSAULT;
          recordToWhichToReplicate.C_1_EVENT_ESASEXUALASSAULTDATE_PERIODOFTHEEVENT = c.C_1_EVENT_ESASEXUALASSAULTDATE_PERIODOFTHEEVENT;
          recordToWhichToReplicate.C_1_EVENT_ESADURATIONOFTHEEVENT_DURATION = c.C_1_EVENT_ESADURATIONOFTHEEVENT_DURATION;
          recordToWhichToReplicate.C_1_EVENT_ESACOUNTRYOFTHEEVENT_COUNTRYOFTHEEVENT = c.C_1_EVENT_ESACOUNTRYOFTHEEVENT_COUNTRYOFTHEEVENT;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_RAPE = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_RAPE;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPROSTITUTION = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPROSTITUTION;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_UNDECLAREDEMPLOYMENT = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_UNDECLAREDEMPLOYMENT;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_COUNTERFEITING = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_COUNTERFEITING;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_KEEPINGABROTHEL = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_KEEPINGABROTHEL;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_TRAFFICKINGINHUMANBEINGS = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_TRAFFICKINGINHUMANBEINGS;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABUSEOFPOSITION = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ADMINISTRATIONOFDRUGS_MED = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ADMINISTRATIONOFDRUGS_MED;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABDUCTION = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_ABDUCTION;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_DECEPTIONOFTHEVICTIMINORD = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_DECEPTIONOFTHEVICTIMINORD;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPORNOGRAPHY = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_CHILDPORNOGRAPHY;
          recordToWhichToReplicate.C_1_EVENT_ESAACTCTXSEXUALASSAULT_BRIBERY = c.C_1_EVENT_ESAACTCTXSEXUALASSAULT_BRIBERY;
          recordToWhichToReplicate.C_1_EVENT_ESAMODUSOPERANDI_SEXUALINTERCOURSE = c.C_1_EVENT_ESAMODUSOPERANDI_SEXUALINTERCOURSE;
          recordToWhichToReplicate.C_1_EVENT_ESAMODUSOPERANDI_SEXUALAGGRESSION = c.C_1_EVENT_ESAMODUSOPERANDI_SEXUALAGGRESSION;
          recordToWhichToReplicate.C_1_EVENT_ESAMODUSOPERANDI_MISUSEOFPOSITION = c.C_1_EVENT_ESAMODUSOPERANDI_MISUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ESAMODUSOPERANDI_ADMINISTRATIONOFDRUGS_MED = c.C_1_EVENT_ESAMODUSOPERANDI_ADMINISTRATIONOFDRUGS_MED;
          recordToWhichToReplicate.C_1_EVENT_ESAMODUSOPERANDI_ABDUCTION = c.C_1_EVENT_ESAMODUSOPERANDI_ABDUCTION;
          recordToWhichToReplicate.C_1_EVENT_ESAMODUSOPERANDI_BYMEANSOFDECEPTION = c.C_1_EVENT_ESAMODUSOPERANDI_BYMEANSOFDECEPTION;
          recordToWhichToReplicate.C_1_EVENT_ESAMODUSOPERANDI_BYMEANSOFFORCE_THREAT = c.C_1_EVENT_ESAMODUSOPERANDI_BYMEANSOFFORCE_THREAT;
          recordToWhichToReplicate.C_1_EVENT_EVENTOFSEXTOURISM_EVENTOFSEXTOURISM = c.C_1_EVENT_EVENTOFSEXTOURISM_EVENTOFSEXTOURISM;
          recordToWhichToReplicate.C_1_EVENT_ESTSEXTOURINSMDATE_PERIODOFTHEEVENT = c.C_1_EVENT_ESTSEXTOURINSMDATE_PERIODOFTHEEVENT;
          recordToWhichToReplicate.C_1_EVENT_ESTDURATIONOFTHEEVENT_DURATION = c.C_1_EVENT_ESTDURATIONOFTHEEVENT_DURATION;
          recordToWhichToReplicate.C_1_EVENT_ESTCOUNTRYOFTHEEVENT_COUNTRYOFTHEEVENT = c.C_1_EVENT_ESTCOUNTRYOFTHEEVENT_COUNTRYOFTHEEVENT;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_RAPE = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_RAPE;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPROSTITUTION = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPROSTITUTION;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_UNDECLAREDEMPLOYMENT = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_UNDECLAREDEMPLOYMENT;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_COUNTERFEITING = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_COUNTERFEITING;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_LOCKINGUPVICTIM = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_LOCKINGUPVICTIM;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_KEEPINGABROTHEL = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_KEEPINGABROTHEL;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_TRAFFICKINGINHUMANBEINGS = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_TRAFFICKINGINHUMANBEINGS;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABUSEOFPOSITION = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ADMINISTRATIONOFDRUGS_MED = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ADMINISTRATIONOFDRUGS_MED;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABDUCTION = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_ABDUCTION;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPORNOGRAPHY = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_CHILDPORNOGRAPHY;
          recordToWhichToReplicate.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_BRIBERY = c.C_1_EVENT_ESTOFFENCESCOMMITTEDINTHE_BRIBERY;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_VIATHEINTERNET = c.C_1_EVENT_ESTMODUSOPERANDI_VIATHEINTERNET;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_SEXUALINTERCOURSE = c.C_1_EVENT_ESTMODUSOPERANDI_SEXUALINTERCOURSE;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_SEXUALAGGRESSION = c.C_1_EVENT_ESTMODUSOPERANDI_SEXUALAGGRESSION;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_PAYMENTFOREACHSERVICE = c.C_1_EVENT_ESTMODUSOPERANDI_PAYMENTFOREACHSERVICE;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_MISUSEOFPOSITION = c.C_1_EVENT_ESTMODUSOPERANDI_MISUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_ADMINISTRATIONOFDRUGS_MED = c.C_1_EVENT_ESTMODUSOPERANDI_ADMINISTRATIONOFDRUGS_MED;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_ABDUCTION = c.C_1_EVENT_ESTMODUSOPERANDI_ABDUCTION;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_BYMEANSOFDECEPTION = c.C_1_EVENT_ESTMODUSOPERANDI_BYMEANSOFDECEPTION;
          recordToWhichToReplicate.C_1_EVENT_ESTMODUSOPERANDI_BYMEANSOFFORCE_THREAT = c.C_1_EVENT_ESTMODUSOPERANDI_BYMEANSOFFORCE_THREAT;
          recordToWhichToReplicate.C_1_EVENT_EVENTOFCHILDPROSTITUTION_EVENTOFCHILDPROSTITUTION = c.C_1_EVENT_EVENTOFCHILDPROSTITUTION_EVENTOFCHILDPROSTITUTION;
          recordToWhichToReplicate.C_1_EVENT_ECPRODATE_PERIODOFTHEEVENT = c.C_1_EVENT_ECPRODATE_PERIODOFTHEEVENT;
          recordToWhichToReplicate.C_1_EVENT_ECPRODATEOFDURATION_DURATION = c.C_1_EVENT_ECPRODATEOFDURATION_DURATION;
          recordToWhichToReplicate.C_1_EVENT_ECPROCOUNTRYOFTHEEVENT_COUNTRYOFTHEEVENT = c.C_1_EVENT_ECPROCOUNTRYOFTHEEVENT_COUNTRYOFTHEEVENT;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_RAPE = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_RAPE;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_UNDECLAREDEMPLOYMENT = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_UNDECLAREDEMPLOYMENT;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_COUNTERFEITING = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_COUNTERFEITING;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_LOCKINGUPVICTIM = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_LOCKINGUPVICTIM;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_KEEPINGABROTHEL = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_KEEPINGABROTHEL;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_TRAFFICKINGINHUMANBEINGS = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_TRAFFICKINGINHUMANBEINGS;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABUSEOFPOSITION = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ADMINISTRATIONOFDRUGS_MED = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ADMINISTRATIONOFDRUGS_MED;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABDUCTION = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_ABDUCTION;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_CHILDPORNOGRAPHY = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_CHILDPORNOGRAPHY;
          recordToWhichToReplicate.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_BRIBERY = c.C_1_EVENT_ECPROOFFENCESCOMMITTEDINT_BRIBERY;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_VIATHEINTERNET = c.C_1_EVENT_ECPROMODUSOPERANDI_VIATHEINTERNET;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_SEXUALINTERCOURSE = c.C_1_EVENT_ECPROMODUSOPERANDI_SEXUALINTERCOURSE;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_SEXUALAGGRESSION = c.C_1_EVENT_ECPROMODUSOPERANDI_SEXUALAGGRESSION;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_MISUSEOFPOSITION = c.C_1_EVENT_ECPROMODUSOPERANDI_MISUSEOFPOSITION;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_ADMINISTRATIONOFDRUGS = c.C_1_EVENT_ECPROMODUSOPERANDI_ADMINISTRATIONOFDRUGS;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_ADMINISTRATIONOFMEDICINES = c.C_1_EVENT_ECPROMODUSOPERANDI_ADMINISTRATIONOFMEDICINES;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_TAKESVICTIMAWAY = c.C_1_EVENT_ECPROMODUSOPERANDI_TAKESVICTIMAWAY;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_LOCKSVICTIMAWAY_TIESHIM_H = c.C_1_EVENT_ECPROMODUSOPERANDI_LOCKSVICTIMAWAY_TIESHIM_H;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_BYMEANSOFDECEPTION = c.C_1_EVENT_ECPROMODUSOPERANDI_BYMEANSOFDECEPTION;
          recordToWhichToReplicate.C_1_EVENT_ECPROMODUSOPERANDI_BYMEANSOFFORCE_THREAT = c.C_1_EVENT_ECPROMODUSOPERANDI_BYMEANSOFFORCE_THREAT;



          dataContext.SubmitChanges();
          myMessage += recordToWhichToReplicate.ID + " - ";
        } //foreach




      } //foreach

      if (myMessage.Length > 0)
      {
        myMessage = "Entries that have been updated - " + myMessage;
      }
      else
      {
        myMessage = "No entries have updated";
      }

      System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>");
      System.Web.HttpContext.Current.Response.Write("alert('" + myMessage + "')");
      System.Web.HttpContext.Current.Response.Write("</SCRIPT>");
    }
  }
}